<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.2" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="工具,node,博客外链,图片失效," />





  <link rel="alternate" href="/atom.xml" title="OBKoro1's Blog" type="application/atom+xml" />




  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.2" />






<meta name="description" content="大约一个月前，微博的图片外链失效了，以及掘金因为盗链问题也于2019/06/06决定开启防盗链，造成的影响是：个人博客网站的引用了这些图片外链都不能显示。 目前微博和掘金的屏蔽，在CSDN和segmentfault都是可以正常显示的，只影响个人博客。 比如前段时间我的博客:http://obkoro1.com上引用的微博图片都不能显示了。 因为我写博客比较频繁，被屏蔽的图片不在少数，肯定不能一个个">
<meta name="keywords" content="工具,node,博客外链,图片失效">
<meta property="og:type" content="article">
<meta property="og:title" content="blog图片失效一键下载&#x2F;替换">
<meta property="og:url" content="http://yoursite.com/2019/07/20/blog图片失效一键下载-替换/index.html">
<meta property="og:site_name" content="OBKoro1&#39;s Blog">
<meta property="og:description" content="大约一个月前，微博的图片外链失效了，以及掘金因为盗链问题也于2019/06/06决定开启防盗链，造成的影响是：个人博客网站的引用了这些图片外链都不能显示。 目前微博和掘金的屏蔽，在CSDN和segmentfault都是可以正常显示的，只影响个人博客。 比如前段时间我的博客:http://obkoro1.com上引用的微博图片都不能显示了。 因为我写博客比较频繁，被屏蔽的图片不在少数，肯定不能一个个">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2019-07-20T07:27:03.669Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="blog图片失效一键下载&#x2F;替换">
<meta name="twitter:description" content="大约一个月前，微博的图片外链失效了，以及掘金因为盗链问题也于2019/06/06决定开启防盗链，造成的影响是：个人博客网站的引用了这些图片外链都不能显示。 目前微博和掘金的屏蔽，在CSDN和segmentfault都是可以正常显示的，只影响个人博客。 比如前段时间我的博客:http://obkoro1.com上引用的微博图片都不能显示了。 因为我写博客比较频繁，被屏蔽的图片不在少数，肯定不能一个个">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.2',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2019/07/20/blog图片失效一键下载-替换/"/>





  <title>blog图片失效一键下载/替换 | OBKoro1's Blog</title>
  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?64d57d0b926bbd27431daa89d2e0a76b";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">OBKoro1's Blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-前端算法">
          <a href="/arithmetic/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-book"></i> <br />
            
            前端算法
          </a>
        </li>
      
        
        <li class="menu-item menu-item-博客最新更新">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            博客最新更新
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-commonweal">
          <a href="/404/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br />
            
            公益404
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2019/07/20/blog图片失效一键下载-替换/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="OBKoro1">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/uploads/hand1.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="OBKoro1's Blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">blog图片失效一键下载/替换</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2019-07-20T15:19:57+08:00">
                2019-07-20
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/工具/" itemprop="url" rel="index">
                    <span itemprop="name">工具</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          
             <span id="/2019/07/20/blog图片失效一键下载-替换/" class="leancloud_visitors" data-flag-title="blog图片失效一键下载/替换">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               
                 <span class="post-meta-item-text">阅读次数&#58;</span>
               
                 <span class="leancloud-visitors-count"></span>
             </span>
          

          

          
            <div class="post-wordcount">
              
                
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                  <span class="post-meta-item-text">字数统计&#58;</span>
                
                <span title="字数统计">
                  1,186 字
                </span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                
                <span title="阅读时长">
                  5分钟
                </span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>大约一个月前，微博的图片外链失效了，以及掘金因为盗链问题也于<code>2019/06/06</code><a href="https://juejin.im/post/5cefb6a3f265da1b95703b9d" target="_blank" rel="noopener">决定开启防盗链</a>，造成的影响是：<strong>个人博客网站的引用了这些图片外链都不能显示</strong>。</p>
<p><strong>目前微博和掘金的屏蔽，在CSDN和segmentfault都是可以正常显示的，只影响个人博客</strong>。</p>
<p>比如前段时间我的博客:<a href="http://obkoro1.com" target="_blank" rel="noopener">http://obkoro1.com</a>上引用的微博图片都不能显示了。</p>
<p>因为我写博客比较频繁，被屏蔽的图片不在少数，肯定不能一个个手动的替换，查了一番没有找到现成的解决方案，做了个脚本工具，并且写了文档把它开源出来了。</p>
<h1 id="markdown-img-down-site-change-下载-替换markdown中的图片"><a href="#markdown-img-down-site-change-下载-替换markdown中的图片" class="headerlink" title="markdown-img-down-site-change(下载/替换markdown中的图片)"></a>markdown-img-down-site-change(下载/替换markdown中的图片)</h1><blockquote>
<p>搜索目标文件夹中的markdown文件，找到目标图片，提供下载图片，替换图片链接的功能-通常用于markdown 图片失效。</p>
</blockquote>
<h3 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h3><p>这是一个极为轻量的脚本，引用包，设置好参数，通过API即可轻松上手。</p>
<h3 id="解决什么问题？"><a href="#解决什么问题？" class="headerlink" title="解决什么问题？"></a>解决什么问题？</h3><ol>
<li>集中下载markdown文件中某个域名下的图片到一个文件夹下。</li>
<li>用新的图片链接替换markdown文件中某个域名的图片链接。</li>
</ol>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// 1. 下载这两个图片</span></span><br><span class="line"><span class="comment">// ![](https://user-gold-cdn.xitu.io/2019/5/20/图片名字?w=2024&amp;h=1240&amp;f=png&amp;s=339262)</span></span><br><span class="line"><span class="comment">// ![](https://user-gold-cdn.xitu.io/2018/6/16/图片名字)</span></span><br><span class="line"><span class="comment">// 2. 替换成：github的链接</span></span><br><span class="line">![](https:<span class="comment">//raw.githubusercontent.com/OBKoro1/articleImg_src/master/juejin/图片名字)</span></span><br><span class="line"><span class="comment">// 由于github的参数限制，带了参数就不能正常显示图片 所有这里默认取图片名前部分的：字母或数字或下划线或汉字</span></span><br></pre></td></tr></table></figure>
<h3 id="安装"><a href="#安装" class="headerlink" title="安装:"></a>安装:</h3><figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm i markdown-img-down-site-change</span><br></pre></td></tr></table></figure>
<h3 id="文档："><a href="#文档：" class="headerlink" title="文档："></a>文档：</h3><p><a href="https://github.com/OBKoro1/markdown-img-down-site-change" target="_blank" rel="noopener">Github</a></p>
<p><a href="https://github.com/OBKoro1/markdown-img-down-site-change/wiki/API" target="_blank" rel="noopener">API</a></p>
<p><a href="https://github.com/OBKoro1/markdown-img-down-site-change/wiki/%E6%9B%B4%E6%96%B0%E6%97%A5%E5%BF%97" target="_blank" rel="noopener">更新日志</a></p>
<h3 id="数据安全："><a href="#数据安全：" class="headerlink" title="数据安全："></a>数据安全：</h3><p>刚上手可能不了解脚本的功能，需要调试一番，这时候万一把<code>markdown</code>文件给改坏了，岂不是要哭死？</p>
<p>脚本有两种形式来防止这种情况发生：</p>
<ol>
<li>脚本会<a href="https://github.com/OBKoro1/markdown-img-down-site-change/wiki/API#copy_item_data%E5%A4%87%E4%BB%BD%E9%A1%B9%E7%9B%AE%E7%9A%84%E5%9C%B0%E5%9D%80" target="_blank" rel="noopener">默认备份</a>你的文件。</li>
<li>默认开启<a href="https://github.com/OBKoro1/markdown-img-down-site-change/wiki/API#test%E6%98%AF%E5%90%A6%E5%BC%80%E5%90%AF%E6%B5%8B%E8%AF%95%E6%A8%A1%E5%BC%8F" target="_blank" rel="noopener">测试模式</a>，等到调试的差不多了，可以关闭测试模式。</li>
<li>建议：再不放心的话，可以先用一两个文件来测试一下脚本</li>
</ol>
<h3 id="插件使用姿势："><a href="#插件使用姿势：" class="headerlink" title="插件使用姿势："></a>插件使用姿势：</h3><p>我是这样使用的，大家可以做个参考：</p>
<ol>
<li>新建一个<a href="https://github.com/OBKoro1/articleImg_src" target="_blank" rel="noopener">github项目</a>,专门用于存放图片资源</li>
<li><code>npm init</code>初始化<code>package.json</code> 文件，下载npm包:<code>npm i markdown-img-down-site-change</code>,</li>
<li>新建一个<code>handleImg.js</code>文件，参考:<a href="https://github.com/OBKoro1/markdown-img-down-site-change/blob/master/example.js" target="_blank" rel="noopener">example.js</a></li>
<li>拷贝你的<code>markdown</code>文件夹到该项目，执行<code>node handleImg.js</code></li>
<li>将会搜索所有<code>.md</code>文件，下载匹配到的图片到项目的根目录。</li>
<li>默认不修改文件,默认开启备份，匹配规则、过滤某些文件夹等更多配置信息参阅：<a href="https://github.com/OBKoro1/markdown-img-down-site-change/wiki/API" target="_blank" rel="noopener">API文档</a></li>
</ol>
<p>比如我的github图床：<a href="https://github.com/OBKoro1/articleImg_src" target="_blank" rel="noopener">articleImg_src</a></p>
<h3 id="使用：20行代码不到"><a href="#使用：20行代码不到" class="headerlink" title="使用：20行代码不到"></a>使用：20行代码不到</h3><p>在项目中有一个使用<a href="https://github.com/OBKoro1/markdown-img-down-site-change/blob/master/example.js" target="_blank" rel="noopener">栗子</a>，里面加了蛮多注释和空行的，实际代码20行都不到，可以说很简单了，如下：</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">// npm i markdown-img-down-site-change -S </span></span><br><span class="line"><span class="keyword">const</span> markdownImageDown = <span class="built_in">require</span>(<span class="string">'markdown-img-down-site-change'</span>); <span class="comment">// 文件模块</span></span><br><span class="line"></span><br><span class="line"><span class="comment">// 传参： 这也是脚本的默认参数，根据情况可以自行修改</span></span><br><span class="line"><span class="keyword">let</span> option = &#123;</span><br><span class="line">    replace_image_url: <span class="string">'https://user-gold-cdn.xitu.io/'</span>,</span><br><span class="line">    read_markdown_src: <span class="string">'./source'</span>, <span class="comment">// 要查找markdown文件的文件夹地址</span></span><br><span class="line">    down_img_src: <span class="string">'./juejin'</span>, <span class="comment">// 下载图片到这个文件夹</span></span><br><span class="line">    var_number: <span class="number">3</span> <span class="comment">// url前半部分的变量数量 比如上面的日期: /2019/5/20/、/2018/6/16/</span></span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="comment">// 初始化</span></span><br><span class="line"><span class="keyword">const</span> markdownImage = <span class="keyword">new</span> markdownImageDown(option)</span><br><span class="line"></span><br><span class="line"><span class="comment">// 下载外链</span></span><br><span class="line">markdownImage.checkDownImg();</span><br><span class="line"></span><br><span class="line"><span class="comment">// 上传下载下来的图片文件夹到云端 用户自己操作</span></span><br><span class="line"></span><br><span class="line"><span class="comment">// 上传图片之后 </span></span><br><span class="line"><span class="comment">// 脚本会把以前的外链替换成云端地址+拼接一个图片名</span></span><br><span class="line">markdownImage.updateOption(&#123;</span><br><span class="line">    new_image_url: <span class="string">'https://xxx.com/目录地址/'</span>, <span class="comment">// 图片上传的地址</span></span><br><span class="line">    add_end: <span class="string">'?raw=true'</span> <span class="comment">// github图片地址有后缀 直接进去是仓库</span></span><br><span class="line">&#125;)</span><br><span class="line"></span><br><span class="line"><span class="comment">// 替换外链 </span></span><br><span class="line"><span class="comment">// 把replace_image_url的字符串换成new_image_url字符串</span></span><br><span class="line">markdownImage.replaceMarkdown();</span><br></pre></td></tr></table></figure>
<h3 id="运行："><a href="#运行：" class="headerlink" title="运行："></a>运行：</h3><p><strong>仔细阅读文本，配置好参数之后</strong></p>
<p>在项目根节点新建一个<code>handleImg.js</code>文件，安装一下脚本，然后用<code>node</code>运行该文件：</p>
<figure class="highlight js"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">npm i markdown-img-down-site-change -S</span><br><span class="line">node handleImg.js</span><br></pre></td></tr></table></figure>
<h2 id="欢迎试用"><a href="#欢迎试用" class="headerlink" title="欢迎试用"></a>欢迎试用</h2><p>有需要的小伙伴，赶紧来试试吧！文档写的很全，上手非常轻松，项目将会持续维护，有什么问题，欢迎给我提<a href="https://github.com/OBKoro1/markdown-img-down-site-change/issues" target="_blank" rel="noopener">issue</a>~</p>
<p>如果觉得这个脚本还不错的话，就给<a href="https://github.com/OBKoro1/markdown-img-down-site-change" target="_blank" rel="noopener">项目</a>点个Star吧！</p>
<p><a href="http://obkoro1.com/" target="_blank" rel="noopener">博客</a>、<a href="http://obkoro1.com/web_accumulate/accumulate/" target="_blank" rel="noopener">前端积累文档</a>、<a href="https://user-gold-cdn.xitu.io/2018/5/1/1631b6f52f7e7015?w=344&amp;h=344&amp;f=jpeg&amp;s=8317" target="_blank" rel="noopener">公众号</a>、wx:OBkoro1、邮箱：<a href="mailto:obkoro1@foxmail.com" target="_blank" rel="noopener">obkoro1@foxmail.com</a></p>
<p> 以上2019.06.04</p>

      
    </div>
    
    
    

    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>听说，打赏我的人最后都找到了真爱。</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/images/pay/weixin.jpg" alt="OBKoro1 微信支付"/>
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/pay/ali.jpg" alt="OBKoro1 支付宝"/>
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/工具/" rel="tag"><i class="fa fa-tag"></i> 工具</a>
          
            <a href="/tags/node/" rel="tag"><i class="fa fa-tag"></i> node</a>
          
            <a href="/tags/博客外链/" rel="tag"><i class="fa fa-tag"></i> 博客外链</a>
          
            <a href="/tags/图片失效/" rel="tag"><i class="fa fa-tag"></i> 图片失效</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2019/05/20/js-调用栈机制与ES6尾调用优化介绍/" rel="next" title="js 调用栈机制与ES6尾调用优化介绍">
                <i class="fa fa-chevron-left"></i> js 调用栈机制与ES6尾调用优化介绍
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2019/08/04/停止更新-新版博客地址/" rel="prev" title="停止更新,新版博客地址">
                停止更新,新版博客地址 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          
            <img class="site-author-image" itemprop="image"
              src="/uploads/hand1.jpg"
              alt="OBKoro1" />
          
            <p class="site-author-name" itemprop="name">OBKoro1</p>
            <p class="site-description motion-element" itemprop="description">种一棵树最好的时间是十年前,其次是现在</p>
        </div>

        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
            
              <a href="/archives">
            
                <span class="site-state-item-count">105</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">20</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">74</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        
          <div class="feed-link motion-element">
            <a href="/atom.xml" rel="alternate">
              <i class="fa fa-rss"></i>
              RSS
            </a>
          </div>
        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/OBKoro1" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>GitHub</a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://juejin.im/user/58714f0eb123db4a2eb95372" target="_blank" title="掘金">
                  
                    <i class="fa fa-fw fa-globe"></i>掘金</a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://obkoro1.com/web_accumulate/" target="_blank" title="前端积累">
                  
                    <i class="fa fa-fw fa-globe"></i>前端积累</a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://segmentfault.com/u/obkoro1/articles" target="_blank" title="segmentfault">
                  
                    <i class="fa fa-fw fa-globe"></i>segmentfault</a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#markdown-img-down-site-change-下载-替换markdown中的图片"><span class="nav-number">1.</span> <span class="nav-text">markdown-img-down-site-change(下载/替换markdown中的图片)</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#简介"><span class="nav-number">1.0.1.</span> <span class="nav-text">简介</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#解决什么问题？"><span class="nav-number">1.0.2.</span> <span class="nav-text">解决什么问题？</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装"><span class="nav-number">1.0.3.</span> <span class="nav-text">安装:</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#文档："><span class="nav-number">1.0.4.</span> <span class="nav-text">文档：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#数据安全："><span class="nav-number">1.0.5.</span> <span class="nav-text">数据安全：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#插件使用姿势："><span class="nav-number">1.0.6.</span> <span class="nav-text">插件使用姿势：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#使用：20行代码不到"><span class="nav-number">1.0.7.</span> <span class="nav-text">使用：20行代码不到</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#运行："><span class="nav-number">1.0.8.</span> <span class="nav-text">运行：</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#欢迎试用"><span class="nav-number">1.1.</span> <span class="nav-text">欢迎试用</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2017 &mdash; 
  <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">OBKoro1</span>

  
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
    
      <span class="post-meta-item-text">Site words total count&#58;</span>
    
    <span title="Site words total count">
      156.0k
    </span>
  
</div>




<div>
<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<span class="site-uv"><i class="fa fa-user"></i> 访问用户： <span class="busuanzi-value" id="busuanzi_value_site_uv">21621</span> 人 </span>
<span class="site-pv"><i class="fa fa-eye"></i> 访问次数： <span class="busuanzi-value" id="busuanzi_value_site_pv">68503</span> 次</span>

</div>



        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  


  











  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>

  
  <script type="text/javascript" src="/lib/canvas-nest/canvas-nest.min.js"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.2"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.2"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.2"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.2"></script>



  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.2"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.2"></script>


  

  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.2"></script>



  


  




	





  





  








  



  





  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script>
  <script>AV.initialize("9ANFp60h6oVyxIPGlau3NOA4-gzGzoHsz", "tMdNuKMbFtN4QsekeNVu83TV");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  

  

  

  

</body>
</html>

